alert("hello");
document.write("this is a write");
let a = 1;
let b = 2;
let c = a + b;
console.log("a+b=" + c);

let str = "nam";
console.log(c, str);
const pi = 3.1415;
console.log(pi);
console.log(typeof str);
console.log(typeof a);
console.log(typeof pi);
let falg = true;
console.log(typeof falg);
let obj = Object();
console.log(typeof obj);
console.log("a =" + a);
a += 1;
console.log("a =" + a);
console.log("a+b=" + c);
console.log(c > a ? 1 : 2);

if (a < c) {
    console.log("a<c");
} else {
    console.log("a>=c");

}

switch (b) {
    case 1:
        console.log(1);
        break;
    case 2:
        console.log(2);
        break;

    default:
        break;
}

switch (b) {
    case 1:
        console.log(1);
        break;
    case 2:
        console.log(2);

    case 3:
        console.log(3);
        break;
    default:
        break;
}



let arr = [1,2,3,4,5,6,7,8];
console.log( "======================for");
for (let index = 0; index < arr.length; index++) {

    console.log(arr[index]);
    
}
console.log( "======================forof");
// for of 中 i 是具体数值
//不可遍历对象
for (let i of arr) {
    console.log(i);
    
}

console.log( "======================forin");

// for in 中 k 代表下标值
// 可以遍历对象
for (let k in arr) {
   console.log(arr[k]);
}

console.log("====================");
let d = 1, e = 6;
function add(r,v) {
    let s = r+v;
    console.log(s);
    
}

add(d,e);
add(1,1);

console.log("====================");
